import { getNestedProperty } from './tool.js';

export const fn = {
    getLocalStoreageValueByKey(storeageKey) {
        let parts = storeageKey.split('.');
        let storeageKeyStr = '';
        if (parts.length > 1) {
            storeageKeyStr = parts.slice(1).join('.');
        }
        return getNestedProperty(JSON.parse(localStorage.getItem(storeageKey.split('.')[0])), storeageKeyStr);
    },

    arrayFilter(array) {
        return array.map(Number).filter(item => item !== '' && item !== null && item !== undefined && !isNaN(item) && item !== 0);
    }

};